﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLT_Public;
using System.Data;

namespace QLT_Data
{
   public  class NhomQuyen_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();
       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("Load_tbl_NhomQuyen");
       }
       public DataTable taobang(string sql)
       {
           return kn.taoBang(sql);
       }
       public int Insert_NhomQuyen(NhomQuyen_Public tenNQ, NhomQuyen_Public ghiChu, NhomQuyen_Public maPQ)
       {
           int Nparameter = 3;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@TenNQ";
           value[0] = tenNQ.TenNQ;
           name[1] = "@GhiChu";
           value[1] = ghiChu.GhiChu;
           name[2] = "@MaPQ";
           value[2] = maPQ.MaPQ;
           return kn.update("insert_NhomQuyen", name, value, Nparameter);
       }
       public int Update_NhomQuyen(NhomQuyen_Public maNQ, NhomQuyen_Public tenNQ, NhomQuyen_Public ghiChu, NhomQuyen_Public maPQ)
       {
           int Nparameter = 4;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "@MaNQ";
           value[0] = maNQ.MaNQ;
           name[1] = "@TenNQ";
           value[1] = tenNQ.TenNQ;
           name[2] = "@GhiChu";
           value[2] = ghiChu.GhiChu;
           name[3] = "@MaPQ";
           value[3] = maPQ.MaPQ;
           return kn.update("update_NhomQuyen", name, value, Nparameter);
       }
       public int Delete_NhomQuyen(NhomQuyen_Public maNQ)
       {
           int Nparameter = 1;
           string[] name = new string[Nparameter];
           object[] value = new object[Nparameter];
           name[0] = "MaNQ";
           value[0] = maNQ.MaNQ;
           return kn.update("delete_NhomQuyen", name, value, Nparameter);
       }
    }
}

